<p>当我们调用<code> InputStream.skip </code> 或 <code> InputStream.read </code>以及<code> InputStream </code>子类的这两个方法时，我们必须接受并检查这些方法的返回值。</p>

<h2>不规范的代码示例</h2>

<pre>
public void doSomething(String fileName) {
  try {
    InputStream is = new InputStream(file);
    byte [] buffer = new byte[1000];
    is.read(buffer);  // Noncompliant
    // ...
  } catch (IOException e) { ... }
}
</pre>

<h2>正确的代码示例</h2>

<pre>
public void doSomething(String fileName) {
  try {
    InputStream is = new InputStream(file);
    byte [] buffer = new byte[1000];
    int count = 0;
    while (count = is.read(buffer) &gt; 0) {
      // ...
    }
  } catch (IOException e) { ... }
}
</pre>